package addon.w3.mdx.com;

import java.io.IOException;

import addon.w3.mdx.MDXCOM;
import addon.w3.mdx.LEDataInputStream;
import addon.w3.mdx.MDXException;

/**
 * struct {
		long	Frame;
		float	State;			(0 or 1)
		if (LineType > 1) {
			float	InTan;
			float	OutTan;
		}
	} alpha[nunks];
 * @author madjk
 *
 */
public class MDXAlphaCOM extends MDXCOM {
	String tag;
	int frame = -1;
	float state = -1;
	int inTan = -1;
	int outTan = -1;
	
	int parentLineType = -1;
	
	public MDXAlphaCOM(String str,int lineType) {
		this.tag = str;
		parentLineType = lineType;
	}
	
	public String getTag() {
		return tag;
	}
	
	public void _decode(LEDataInputStream ins) throws IOException, MDXException {
		frame = ins.readInt();
		state = ins.readFloat();
		if(parentLineType > 1) {
			inTan = ins.readInt();
			outTan = ins.readInt();
		}
	}
	
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("TAG : "+getTag());
		sb.append("\n\tFRAME : "+frame);
		sb.append("\n\tSTATE : "+state);
		if(parentLineType > 1) {
			sb.append("\n\tINTAN : "+inTan);
			sb.append("\n\tOUTTAN : "+outTan);
		}
		return sb.toString();
	}

	@Override
	public boolean isImplicitTag() {
		return false;
	}
}